package com.team.bus.module.organization.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import com.team.bus.module.menu.model.Menu;
import com.team.bus.module.user.model.User;

@Entity
@Table(name = "torganization",schema = "miaoxu")
public class Organization implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private String id;
	private Organization organization;
	private String address;
	private String code;
	private String createdatetime;
	private String text;
	private String orderno;
	private String updatedatetime;
	private String url;
	private String organzationflag;											//判断用户属于哪个单位
    private String value;
    private String pbcyz;
    private String qzyz;

	private Set<Organization> organizations = new HashSet<Organization>(0);
	private Set<User> users = new HashSet<User>(0);
	private Set<Menu> menus = new HashSet<Menu>(0);
	
	private String mainman;
	private String fenman;
	private String allics;
	private String noisc;
	private String fuyi;
	private String susong;
	private String fkbank;
	private String fkbanknums;
	private String postcode;
	
	

	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	@Column(name = "id", unique = true, nullable = false, length = 50)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pid")
	public Organization getOrganization() {
		return this.organization;
	}

	public void setOrganization(Organization organization) {
		this.organization = organization;
	}

	@Column(name = "address", length = 100)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "code", length = 50)
	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name = "createdatetime", length = 50)
	public String getCreatedatetime() {
		return this.createdatetime;
	}

	public void setCreatedatetime(String createdatetime) {
		this.createdatetime = createdatetime;
	}

	@Column(name = "text", length = 50)
	public String getText() {
		return this.text;
	}

	public void setText(String text) {
		this.text = text;
	}

	@Column(name = "orderno", length = 50)
	public String getOrderno() {
		return this.orderno;
	}

	public void setOrderno(String orderno) {
		this.orderno = orderno;
	}

	@Column(name = "updatedatetime", length = 50)
	public String getUpdatedatetime() {
		return this.updatedatetime;
	}

	public void setUpdatedatetime(String updatedatetime) {
		this.updatedatetime = updatedatetime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "organization")
	public Set<Organization> getOrganizations() {
		return this.organizations;
	}

	public void setOrganizations(Set<Organization> organizations) {
		this.organizations = organizations;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "tuser_oganization", schema = "", 
	joinColumns = { @JoinColumn(name = "organizationid", nullable = false, updatable = false) }, 
	inverseJoinColumns = { @JoinColumn(name = "userid", nullable = false, updatable = false) })
	public Set<User> getUsers() {
		return users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "tmenu_organization", schema = "", 
	joinColumns = { @JoinColumn(name = "organizationid", nullable = false, updatable = false) }, 
	inverseJoinColumns = { @JoinColumn(name = "menuid", nullable = false, updatable = false) })
	public Set<Menu> getMenus() {
		return menus;
	}

	public void setMenus(Set<Menu> menus) {
		this.menus = menus;
	}

	@Column(name = "organzationflag", length = 50)
	public String getOrganzationflag() {
		return organzationflag;
	}

	public void setOrganzationflag(String organzationflag) {
		this.organzationflag = organzationflag;
	}

    @Column(name = "value", length = 100)
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Column(name = "mainman", length = 100)
	public String getMainman() {
		return mainman;
	}

	public void setMainman(String mainman) {
		this.mainman = mainman;
	}

    @Column(name = "fenman", length = 100)
	public String getFenman() {
		return fenman;
	}

	public void setFenman(String fenman) {
		this.fenman = fenman;
	}

    @Column(name = "allics", length = 100)
	public String getAllics() {
		return allics;
	}

	public void setAllics(String allics) {
		this.allics = allics;
	}

    @Column(name = "noisc", length = 100)
	public String getNoisc() {
		return noisc;
	}

	public void setNoisc(String noisc) {
		this.noisc = noisc;
	}

    @Column(name = "fuyi", length = 100)
	public String getFuyi() {
		return fuyi;
	}

	public void setFuyi(String fuyi) {
		this.fuyi = fuyi;
	}

    @Column(name = "susong", length = 100)
	public String getSusong() {
		return susong;
	}

	public void setSusong(String susong) {
		this.susong = susong;
	}

    @Column(name = "fkbank", length = 100)
	public String getFkbank() {
		return fkbank;
	}

	public void setFkbank(String fkbank) {
		this.fkbank = fkbank;
	}

    @Column(name = "fkbanknums", length = 100)
	public String getFkbanknums() {
		return fkbanknums;
	}

	public void setFkbanknums(String fkbanknums) {
		this.fkbanknums = fkbanknums;
	}

    @Column(name = "postcode", length = 100)
	public String getPostcode() {
		return postcode;
	}

	public void setPostcode(String postcode) {
		this.postcode = postcode;
	}

	@Column(name = "pbcyz", length = 100)
	public String getPbcyz() {
		return pbcyz;
	}

	public void setPbcyz(String pbcyz) {
		this.pbcyz = pbcyz;
	}

	@Column(name = "qzyz", length = 100)
	public String getQzyz() {
		return qzyz;
	}

	public void setQzyz(String qzyz) {
		this.qzyz = qzyz;
	}
}